var httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
var sourceUrl = document.referrer;
var accessUrl = window.location.href;
httpRequest.open('GET', '/statistics/record?sourceUrl='+sourceUrl +'&accessUrl='+accessUrl, true);//第二步：打开连接  将请求参数写在url中  ps:"./Ptest.php?name=test&nameone=testone"
httpRequest.send();//第三步：发送请求  将请求参数写在URL中
/**
 * 获取数据后的处理程序
 */
httpRequest.onreadystatechange = function () {
    if (httpRequest.readyState == 4 && httpRequest.status == 200) {
        var json = httpRequest.responseText;//获取到json字符串，还需解析
        console.log(json);
    }
};

var _hmt = _hmt || [];
(function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?76229e38d6611e860d08ecaf94bc00ee";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();